<?php
$data = $db->fetch_first("
    SELECT `pl`.*,`pi`.*,`pd`.`content` FROM `product_list` `pl`
    LEFT JOIN `product_info` `pi` ON `pi`.`prod_id`=`pl`.`id`
    LEFT JOIN `product_desc` `pd` ON `pd`.`prod_id`=`pl`.`id` AND `pd`.`status`='LATEST'
    WHERE `pl`.`id`='".intval($product_id)."'
    ");
$gallery_array = $db->fetch_all("
    SELECT `img_url`,`img_desc`,`thumb_url` FROM `product_gallery`
    WHERE `prod_id`='".intval($product_id)."' AND `status`='OK'
    ");
$cat_id_array = explode(',',$data['cat_ids']);
$cat_name_array = array();
foreach($cat_id_array as $v){
    $cat_name_array[$v] = $category_list[$v]['name'];
}
?>
